<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no" />
		<title>速翔网络 - QQ技术：1424445608</title>
		<link rel="stylesheet" type="text/css" href="../c/aui.css" />
		<style>
			body{
				height: 100%;
			}
			.ad, .ad img {
					width: 100%;
					height: 100%;
			}
			#x{
				position: fixed;
				top: 0rem;
				right: 0rem;
				margin-right: 0.75rem;
				margin-top: 0.75rem;
			}
			#djs {
				background: rgba(255, 255, 255, 0.1);
				color: #fff;
				font-weight: bold;
				padding: 0.5rem 1rem;
				font-size: 0.65rem;
				border-radius: 0.25rem;
			}

		</style>
	</head>
	<body>
		<div class="ad" tapmode onclick="url()">
			<img src="../i/loading_720.png"  />
		</div>
		<div id="x">
			<em  tapmode onclick="c()" id="djs">跳过 <b>0</b></em>
		</div>

	</body>
	<script type="text/javascript" src="../j/api.js"></script>
	<script type="text/javascript">
		var s = 0,data,adjson
		apiready = function() {

			// 判断返回键
			api.addEventListener({
				name : 'keyback'
			}, function(ret, err) {
			});
			$api.fixStatusBar($api.dom('#x'));
			api.parseTapmode();
			adjson=_getPrefs('ad')
			data=adjson.data
			_ajax('ad/click/id/'+data.id);
			var image=_getPrefs('adimage',true);
			$api.html($api.dom('.ad'),'<img src="'+image+'"  />');
		//	console.log(image)
			s=adjson.time;
			$api.text($api.dom('#djs b'),s);
			djs()
			adAjax()
			setTimeout(function(){
				api.execScript({
				    name: 'root',
				    frameName: 'scrollVideo',
				    script: 'scrollVideo.pause();'
				});
			},2500)
		//	_msg(data.id)
			//alert(JSON.stringify(adjson));
		}
		function djs() {
			s--;
			$api.text($api.dom('#djs b'),s);
			setTimeout(function(){
				if(s==0){
					c()
					return;
				}else{
					djs()
				}
			}, 1000)
		}
		function c(){
			api.closeWin({name:'ad_kaiping'});
		}
		function url(){
			_ajax('ad/click/zhanshi/1/id/'+data.id);
			_url({url:data.url,title:data.title},'curl')
			// setTimeout(function(){
			// 	c()
			// },300)
		}
		// 更新广告地址
		function adAjax(){
			var id=_getPrefs('ad').data.id;
			_ajax('ad/view',function(ret,err){
				if(ret){
					if(ret.ret){
					//	console.log(JSON.stringify(ret.ret));
						_setPrefs('ad', ret.ret);
						s=ret.ret.time
						$api.text($api.dom('#djs b'),s);
					//	console.log(api.frameName+'开始缓存：'+_sx_qiniu+ret.ret.data.img)
						api.imageCache({
							// url : _sx_qiniu + ret.ret.data.img+'?imageView2/3/w/'+api.winWidth+'/h/'+api.winHeight+'/format/jpg',
							url : _img(ret.ret.data.img,api.winWidth+100,api.winHeight+100),
							thumbnail:false,
						}, function(ret, err) {
							if (ret) {
								if (ret.status) {
								//	console.log(api.frameName+'缓存成功'+ret.url);
					//				console.log(ret.url);
									_setPrefs('adimage', ret.url);
								}
							}
						});
						return;
					}
				}
				_removePrefs('ad')
				_removePrefs('adimage')
			})
		}

	</script>
</html>
